package delphorm.web.controller;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import delphorm.service.personne.IPersonne;


public class SupprimerUtilisateur implements Controller {
	private IPersonne servicePersonne;
	private String successView;
	public String getSuccessView() {
		return successView;
	}
	public void setSuccessView(String successView) {
		this.successView = successView;
	}
	public IPersonne getServicePersonne() {
		return servicePersonne;
	}
	public void setServicePersonne(IPersonne servicePersonne) {
		this.servicePersonne = servicePersonne;
	}
	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String numStr = request.getParameter("idutilisateur");
		//TODO exception si null
		
		Long numero = new Long(Integer.parseInt(numStr));
		//TODO exception si erreur
		
		servicePersonne.supprimerUtilisateurParId(numero);
		
		return new ModelAndView(getSuccessView(),null);
	}
	
}
